
import { InitArguments } from "maishu-admin";
import { ImageService } from "maishu-services-sdk";


export const serviceHost = '127.0.0.1:2856'
let { protocol } = location;

export default function (args: InitArguments) {
    ImageService.baseUrl = `${protocol}//${serviceHost}/image`;

    args.app.setModulePath("station/*", "admin/modules/station/*");
    args.app.setModulePath("components/*", "components/*");

    let lib = `lib`;
    requirejs.config({
        shim: {
            qrcode: {
                exports: 'QRCode'
            },
            'jquery-ui': {
                exports: 'window["$"]',
                deps: [
                    'jquery',
                    `css!${lib}/jquery-ui-1.10.0.custom`
                ]
            },
        },
        paths: {
            "clipboard": `${lib}/clipboard.min`,
            'qrcode': `${lib}/qrcode`,
            "jquery-ui": `${lib}/jquery-ui`,
            "jquery": `${lib}/jquery-2.1.3`,
        }
    })

}

function intiRequireJS() {
    let lib = `../lib`;
    requirejs.config({
        shim: {
            ace: {
                deps: ['jquery', 'bootstrap']
            },
            bootstrap: {
                deps: ['jquery']
            },
            dilu: {
                exports: "maishu-dilu"
            },
            application: {
                deps: ['chitu']
            },
            'jquery-ui': {
                exports: 'window["$"]',
                deps: [
                    'jquery',
                    `css!${lib}/jquery-ui-1.10.0.custom`
                ]
            },
            mobileControls: {
                exports: 'controls',
                deps: ['hammer', 'bezier-easing']
            },
            um: {
                deps: [
                    'jquery',
                    'css!../lib/umeditor/themes/default/css/umeditor.css',
                    // '../lib/umeditor/third-party/template.min',
                    'um_config',
                ]
            },
            um_zh: {
                deps: ['um']
            },
            qrcode: {
                exports: 'QRCode'
            },
            wuzhui: {
                deps: ['jquery']
            }
        },
        paths: {

            css: `${lib}/css`,
            less: `${lib}/require-less-0.1.5/less`,
            lessc: `${lib}/require-less-0.1.5/lessc`,
            normalize: `${lib}/require-less-0.1.5/normalize`,
            text: `${lib}/text`,


            ace_editor: `${lib}/ace-builds/src`,
            'art-template': `${lib}/template-web`,
            bootstrap: `${lib}/bootstrap`,

            clipboard: `${lib}/clipboard.min`,
            dilu: `${lib}/dilu`,
            formValidator: `${lib}/formValidator`,
            hammer: `${lib}/hammer`,
            iscroll: `${lib}/iscroll-lite`,
            jquery: `${lib}/jquery-2.1.3`,
            react: `${lib}/react.development`,
            mobileControls: `${lib}/mobileControls`,
            move: `${lib}/move`,

            polyfill: `${lib}/polyfill`,
            polished: `${lib}/polished`,

            ui: `${lib}/ui`,
            um: `${lib}/umeditor/umeditor`,
            um_config: `${lib}/umeditor/umeditor.config`,
            um_zh: `${lib}/umeditor/lang/zh-cn/zh-cn`,

            knockout: `${lib}/knockout-3.2.0.debug`,
            'knockout.validation': `${lib}/knockout.validation`,

            'bezier-easing': `${lib}/bezier-easing`,
            'jquery.fileupload': `${lib}/jQuery.FileUpload/jquery.fileupload`,
            'jquery.validate': `${lib}/jquery.validate`,
            'jquery-ui': `${lib}/jquery-ui`,//'https://cdn.bootcss.com/jqueryui/1.12.1/jquery-ui.min',//
            'jquery.ui.widget': `${lib}/jquery.ui.widget`,
            'js-xlsx': `${lib}/js-xlsx/xlsx.full.min`,
            'js-md5': `${node_modules}/js-md5/src/md5`,
            'qrcode': `${lib}/qrcode`,
            'react-dom': `${lib}/react-dom.development`,
            'prop-types': `${lib}/prop-types`,

            'chitu': `${node_modules}/maishu-chitu/out/index`,
            'chitu.mobile': `${lib}/chitu.mobile`,
            'wuzhui': `${lib}/wuzhui`,

            ace: 'assets/js/uncompressed/ace',

            'ue': `${lib}/ueditor`,//'http://web.bailunmei.com/ueditor',//
            adminServices: 'admin/services',
            'masterPage': 'admin/masterPage',
            modules: 'admin/modules',
            content: 'admin/content',
            'ue.ext': 'admin/ue.ext',
            myWuZhui: 'admin/myWuZhui',
            'socket.io': 'http://shopws.bailunmei.com/socket.io/socket.io',

            //=============================================================
            // 页面路径
            // 'modules/station/store/home': `${modules}/station/storePageDesign`,
            // 'modules/station/store/member': `${modules}/station/storePageDesign`,
            // 'modules/station/store/menu': `${modules}/station/storePageDesign`,
            // 'modules/station/store/coupon': `${modules}/station/storePageDesign`,

            //=============================================================
        }
    });
}